﻿@using ALinq.BBS
@{
    var siteMap = AdminSiteMapProvider.Instance;
    string title = string.Empty;

    IEnumerable<SiteMapNode> siteNodes = new SiteMapNode[] { };
    
    var p = siteMap.CurrentNode;
    if (p != null)
    {
        title = p.Title;
        //.ParentNode.ParentNode;
        if (p.ParentNode == null)
        {
            //Current Node 是一级
            siteNodes = new SiteMapNode[] { siteMap.CurrentNode };
        }
        else if (p.ParentNode.ParentNode == null)
        {
            //Current Node 是二级
            siteNodes = new SiteMapNode[] { siteMap.CurrentNode };
        }
        else if (p.ParentNode.ParentNode.ParentNode == null)
        {
            //Current Node 是三级
            siteNodes = new SiteMapNode[] { siteMap.CurrentNode };
        }
        else if (p.ParentNode.ParentNode.ParentNode.ParentNode == null)
        {
            //Current Node 是四级
            siteNodes = siteMap.CurrentNode.ParentNode.ChildNodes.Cast<SiteMapNode>();
        }
        PageData["Title"] = siteMap.CurrentNode.Title;
    }

}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>@title</title>
    <link rel="Stylesheet" href="@Url.Content("~/Content/Admin/Resource/stylenew.css")" type="text/css" />
    <link rel="Stylesheet" href="@Url.Content("~/Content/Admin/Style.css")" type="text/css" />
    <style type="text/css">
        table
        {
            width: 100%;
        }
    </style>
    <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
</head>
<body>
    <div id="main">
        <div>
            <!--TODO: HEADER-->
        </div>
        <div id="forum_a">
            <div class="forum_a_l">
                <div class="box">
                    <div class="tl">
                    </div>
                    <div class="tr">
                    </div>
                    <div class="bl">
                    </div>
                    <div class="br">
                    </div>
                    <div class="tt">
                    </div>
                    <div class="bb">
                    </div>
                    <div class="ll">
                        <div class="rr">
                            <div class="box_content" style="padding-bottom:0px;">
                                <a href="@siteMap.RootNode.Url">@siteMap.RootNode.Title</a>
                            </div>
                            <div class="box_content">
                                @foreach (SiteMapNode node in siteMap.RootNode.ChildNodes)
                                {
                                    <div class="box_title">
                                        @node.Title
                                    </div>
                                    <ul class="l_a m_a c m_b">
                                        @foreach (SiteMapNode child in node.ChildNodes)
                                        {
                                            if (string.IsNullOrEmpty(child.Url) && child.ChildNodes.Count > 0)
                                            {
                                            <li><a href="@child.ChildNodes[0].Url">@child.Title</a></li>
                                            }
                                            else
                                            {
                                            <li><a href="@child.Url">@child.Title</a></li>
                                            }
                                        }
                                    </ul>
                                }
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="forum_a_m" style="width: 670px;">
                <div class="tabs_a">
                    <ul class="c">
                        @foreach (SiteMapNode item in siteNodes)
                        {
                            if (item == siteMap.CurrentNode)
                            {
                            <li class="focus"><a href="@item.Url" style="width:80px; text-align:center;">@item.Title<span class="lll"></span><span class="rrr"></span></a></li>
                            }
                            else
                            {
                            <li><a href="@item.Url" style="text-align:center;">@item.Title<span class="lll"></span><span class="rrr"></span></a></li>
                            }
                        }
                    </ul>
                </div>
                <div class="admin_tip" style="margin: 2px 0px 2px 0px;">
                    @PageData["Tips"]
                </div>
                @RenderBody()
            </div>
        </div>
        <div class="HackBox">
        </div>
        <div>
            <!--TODO: FOOTER-->
        </div>
    </div>
</body>
</html>
